package com.tailyou.hms.firstapp.act;

import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;

import androidx.appcompat.app.AppCompatActivity;

import com.tailyou.hms.firstapp.R;

public class ProviderActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_provider);
        ContentResolver resolver = getContentResolver();
        Uri uri_stu = Uri.parse("content://com.tailyou.hms.firstapp.provider/stu_table");
        Cursor cursor = resolver.query(uri_stu, null, null, null, null);
        while (cursor.moveToNext()) {
            int id = cursor.getInt(0);
            String stuName = cursor.getString(1);
            String stuNo = cursor.getString(2);
            Log.d("SQLite", id + "-" + stuName + "-" + stuNo);
        }
        cursor.close();
    }

}